package org.Vancl.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.Vancl.Dao.ShoppingCarDao;
import org.Vancl.Dao.ImpI.ShoppingCarDaoImpI;
@WebServlet(urlPatterns="/ShoppingCarDelete.Shtml")
public class ShoppingCarDeleteShoppingServlet extends HttpServlet {
		@Override
		protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			PrintWriter out=resp.getWriter();
			req.setCharacterEncoding("utf-8");
			resp.setContentType("text/html; charset=utf-8");
			String[] deleteid=req.getParameterValues("checkeds");
			ShoppingCarDao shoppingCarDao=new ShoppingCarDaoImpI();
			for (int i = 0; i < deleteid.length; i++) {
				shoppingCarDao.delShopping(Integer.parseInt(deleteid[i]));
			}
			resp.sendRedirect(req.getContextPath()+"/ShoppingCar.shtml");
		}
		@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			this.doGet(req, resp);
		}
}
